/*
 * =====================================================================================
 *
 *       Filename:  shapeGrammar.h
 *
 *    Description:  Class describing a shape grammar, consisting of rules and shapes
 *
 *        Version:  1.0
 *        Created:  30/06/12 13:58:20
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  Moos Hueting (mh), mooshueting@gmail.com
 *   Organization:  UCL
 *
 * =====================================================================================
 */

#ifndef _SHAPE_GRAMMAR
#define _SHAPE_GRAMMAR

#include <vector>
#include "segmentLibrary.h"
#include "rule.h"
#include "character.h"

class ShapeGrammar {
    SegmentLibrary lib;
    vector<Rule> rules;
public:
    ShapeGrammar(SegmentLibrary _lib) : lib(_lib) { generateRules(); }
    ShapeGrammar(SegmentLibrary _lib, vector<Rule> _rules) : lib(_lib), rules(_rules) {};

    void addRule(Rule rule) { rules.push_back(rule); }

    int getSize() { return rules.size(); }

    Rule getRule(int i) { return rules.at(i); }
    Rule getRandomRule();
    Rule getRandomInitialRule();
    vector<Rule> applicableRules(Segment seg);

    Character generateCharacter(int, int);

    void generateRules();

};

#endif
